﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;

namespace AspAjaxWcfMockup
{
    [ServiceContract(Namespace = "AspAjaxWcfMockup")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class AjaxServ
    {
        // To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
        // To create an operation that returns XML,
        //     add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
        //     and include the following line in the operation body:
        //         WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
        [OperationContract]
        public CompositeType TestService()
        {
            // Add your operation implementation here
            return new CompositeType("Testing: " + DateTime.Now.ToLongTimeString());
        }

        // Add more operations here and mark them with [OperationContract]
        [DataContract]
        public class CompositeType
        {
            private string _text;

            public CompositeType(string StringValue)
            {
                _text = StringValue;
            }

            [DataMember]
            public string Text
            {
                get { return _text; }
                set { _text = value; }
            }
        }
    }
}
